import com.spring.demo.controller.StudentController;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class App2 {
    public static void main(String[] args) {
        //1. 得到Spring上下文对象
        BeanFactory beanFactory =
                new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
        //2.从spring 容器中获取bean对象
        StudentController student = (StudentController) beanFactory.getBean("student");
        //3. 使用bean
        student.sayHi();
    }
}
